#include <iostream>
#include <string>

using namespace std;

class Solution{
	public:
		int lengthOfLastWord(string s){
			int count = 0;
			string::reverse_iterator it = s.rbegin();
			for(; it != s.rend(); it++){
				if (*it != ' ') break;
			}
			for(; it != s.rend(); it++){
				if(* it != ' ') count++;
				else break;
			}
		}
};
